# 引入项目通用 cmake 设置
include(common)

if (DEFINED THIRD_PARTY_LIBS)
  set(ZeroMQ_DIR ${THIRD_PARTY_LIBS}/libzmq/dist)
  set(CPPZMQ_DIR ${THIRD_PARTY_LIBS}/cppzmq)
endif()

# =============================================================================
macro(use_libzmq ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_ZMQ)
  target_compile_definitions(${ag_project_name} PRIVATE ZMQ_STATIC)

  target_include_directories(${ag_project_name} PRIVATE ${ZeroMQ_DIR}/$<CONFIG>/include)
  target_include_directories(${ag_project_name} PRIVATE ${CPPZMQ_DIR})

  target_link_directories(${ag_project_name} PRIVATE ${ZeroMQ_DIR}/$<CONFIG>/lib)
  target_link_libraries(${ag_project_name} PRIVATE libzmq-mt-s$<$<CONFIG:Debug>:gd>-4_3_4)

  if(OS_WINDOWS)
    # 静态链接 libzmq 时，需要这些库
    target_link_libraries(${ag_project_name} PRIVATE 
      #wsock32.lib
      #ws2_32.lib
      Iphlpapi.lib
      )
  endif()
endmacro(use_libzmq)